//package com.hc.testaudio.delete.ui
//
//import android.Manifest
//import android.media.AudioFormat
//import android.media.AudioRecord
//import android.os.Bundle
//
//import com.yc.yclibrary.base.YcAppCompatActivity
//import kotlinx.android.synthetic.main.audio_activity.*
//import android.media.MediaRecorder
//import android.widget.Toast
//import com.hc.testaudio.delete.util.start.AudioHelper
//import com.yc.yclibx.permissions.YcUtilPermission
//
//
///**
// *
// */
//class AudioActivity : YcAppCompatActivity() {
//    var frequency = 44100 //分辨率
//    val channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO
//    val audioEncodeing = AudioFormat.ENCODING_PCM_16BIT
//    var mAudioHepler = AudioHelper()
//    override fun getLayoutId(): Int {
//        return com.hc.testaudio.R.layout.audio_activity
//    }
//
//    override fun initView(savedInstanceState: Bundle?) {
//        YcUtilPermission.newInstance(activity).addPermissions(YcUtilPermission.PERMISSION_STORAGE)
//                .addPermissions(Manifest.permission.RECORD_AUDIO)
//                .addPermissions(Manifest.permission.CAMERA).start()
//        audioStartBtn.setOnClickListener {
//            try {
//                val minBufferSize = getMinBuffer()
//                val audioRecord = AudioRecord(MediaRecorder.AudioSource.MIC, frequency, channelConfiguration, audioEncodeing, minBufferSize)
//                mAudioHepler.baseLine = audioSv.height - 100f
//                mAudioHepler.frequence = frequency
//                mAudioHepler.start(audioRecord, minBufferSize, audioSv)
//                Toast.makeText(activity, "当前设备支持您所选择的采样率:$frequency", Toast.LENGTH_SHORT).show()
//            } catch (e: Exception) {
//                Toast.makeText(activity, "当前设备不支持你所选择的采样率:$frequency,请重新选择", Toast.LENGTH_SHORT)
//                        .show()
//            }
//        }
//        audioEndBtn.setOnClickListener {
//            mAudioHepler.stop()
//        }
//    }
//
//
//    private fun getMinBuffer(): Int {
//        return AudioRecord.getMinBufferSize(frequency, channelConfiguration, audioEncodeing)
//    }
//}
